<template>
    <view>
        <view class="yz_code rel"></view>
        <button @tap="add_market" :style="'background:' + color">确认核销</button>
    </view>
</template>

<script>
import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
import gettel from '@/ymq_canyino2o/dist/gettel/index';
var app = getApp();
export default {
    components: {
        cardlist,
        gettel
    },
    data() {
        return {
            userInfo: '',
            order_id: '',
            color: ''
        };
    },
    onLoad: function (o) {
        var that = this;
        app.globalData.setNavigationBarColor(that);
        var t = decodeURIComponent(o.scene);
        app.globalData.getUserInfo(function (o) {
            console.log(o);
            that.setData({
                userInfo: o,
                order_id: t
            });
        });
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {},
    onReachBottom: function () {},
    onShareAppMessage: function () {},
    methods: {
        add_market: function (o) {
            var n = this.userInfo.id;
            var t = this.order_id;
            app.globalData.util.request({
                url: 'entry/wxapp/GroupVerification',
                cachetime: '0',
                data: {
                    order_id: t,
                    user_id: n
                },
                success: function (o) {
                    console.log(o);
                    if ('核销成功' == o.data) {
                        uni.showToast({
                            title: '核销成功'
                        });
                    } else {
                        uni.showToast({
                            title: '核销失败'
                        });
                    }
                    setTimeout(function () {
                        uni.reLaunch({
                            url: '../Liar/loginindex'
                        });
                    }, 1500);
                }
            });
        }
    }
};
</script>
<style>
@import './yz_code.css';
</style>
